package com.moduls.interfaceFunction.core;

import java.util.HashMap;
import java.util.Map;

public class AuthorFactory {
    private static final Map<AuthorType, AuthorService> prMap = new HashMap();
    public static synchronized AuthorService createProduct(AuthorType type) {
        AuthorService authorService = null;

        if(prMap.containsKey(type)) {
            authorService = prMap.get(type);
        } else {
            if(type==AuthorType.Cache) {
                authorService = new CacheAuthorService();
            }

            prMap.put(type, authorService);
        }
        return authorService;
    }
}
